Pandas data_reader??

by: davidjackson1955, 9 years ago

Last edited: 9 years ago

Well,  installed "pandas_datareader but it's not working as expected? if I enter it in the python shell line by line (see below) it works as advertised? But when I an run it as a script it crashes; "python3 script.py " (errors below):
<pre class='prettyprint lang-py'>
import pandas_datareader.data as web
import datetime
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2013, 1, 27)
f = web.DataReader("F", 'yahoo-dividends', start, end)
f
</pre>
<pre class='prettyprint lang-py'>
Traceback (most recent call last):
  File "pandas.py", line 1, in <module>
    import pandas_datareader.data as web
  File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/__init__.py", line 3, in <module>
    from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo,
  File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/data.py", line 7, in <module>
    from pandas_datareader.google.daily import GoogleDailyReader
  File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/google/daily.py", line 1, in <module>
    from pandas_datareader.base import _DailyBaseReader
  File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/base.py", line 9, in <module>
    from pandas import to_datetime
  File "/home/pi/python/pandas.py", line 1, in <module>
    import pandas_datareader.data as web
AttributeError: 'module' object has no attribute 'data'
</pre>



You must be logged in to post. Please login or register an account.



After deleting the pandas.py and pandas.pyc files from my home directory everything seems to be working ok now.

-davidjackson1955 9 years ago

You must be logged in to post. Please login or register an account.


Curiously, when you posted, did you post those pre tags?

edit: also, it sounds like maybe you named the file you were working with, pandas.py?

-Harrison 9 years ago
Last edited 9 years ago

You must be logged in to post. Please login or register an account.


Yes I did use the pre tags.
Yep, I had a pandas.py (*.pyc) scripts in the directory I was trying to run the other script from.
Which explains why the script I was trying run, ran fine when I ran it from idle3 shell...

-davidjackson1955 9 years ago

You must be logged in to post. Please login or register an account.